package edu.gdut.thesissys.vo;

import java.util.HashSet;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

/**
 * CommonGroup entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "common_group", catalog = "gdutmis")
public class CommonGroup extends BaseVo implements java.io.Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = -2537221822447861810L;
	// Fields

	private Integer commonGroupId;
	private Teacher teacher;
	private String replyTime;
	private String replyAddress;
	private Set<Teacher> teachers = new HashSet<Teacher>(0);

	// Constructors

	/** default constructor */
	public CommonGroup() {
	}

	/** full constructor */
	public CommonGroup(Teacher teacher, String replyTime, String replyAddress,
			Set<Teacher> teachers) {
		this.teacher = teacher;
		this.replyTime = replyTime;
		this.replyAddress = replyAddress;
		this.teachers = teachers;
	}

	// Property accessors
	@Id
	@GeneratedValue(strategy = IDENTITY)
	@Column(name = "common_group_id", unique = true, nullable = false)
	public Integer getCommonGroupId() {
		return this.commonGroupId;
	}

	public void setCommonGroupId(Integer commonGroupId) {
		this.commonGroupId = commonGroupId;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "common_leader_id")
	public Teacher getTeacher() {
		return this.teacher;
	}

	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}

	@Column(name = "reply_time", length = 20)
	public String getReplyTime() {
		return this.replyTime;
	}

	public void setReplyTime(String replyTime) {
		this.replyTime = replyTime;
	}

	@Column(name = "reply_address", length = 15)
	public String getReplyAddress() {
		return this.replyAddress;
	}

	public void setReplyAddress(String replyAddress) {
		this.replyAddress = replyAddress;
	}

	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "commonGroup")
	public Set<Teacher> getTeachers() {
		return this.teachers;
	}

	public void setTeachers(Set<Teacher> teachers) {
		this.teachers = teachers;
	}

}